package org.HisCanvas.ChrisRiffle.JFlightLog.launching;

import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import org.HisCanvas.ChrisRiffle.JFlightLog.logging.LogController;
import org.HisCanvas.ChrisRiffle.JFlightLog.swingUi.mainTopFrame.FlightLogMainFrameController;



/**
 * 
 * @author RIF
 *
 */
public class JFlightLogSwingLauncher {
	
	
	private FlightLogMainFrameController mainFrameController;
	
	
	/**
	 *  launches
	 */
	private void launch() {
	
		try{
			
			JFlightLogController.instance().getLogBookDao().init();
			
		}catch (Exception e) {
			
			e.printStackTrace();
			LogController.severe("Can't get to the DAO: " + e.getMessage());			
		}
		
		
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception e){
			e.printStackTrace();
			LogController.warning(e.getMessage());
		}
		
		
		SwingUtilities.invokeLater(new Runnable() {			
			@Override
			public void run() {
				FlightLogMainFrameController.instance().displayMainFrame();				
			}
		});		
				
	}
	
	
	
	/**
	 * entry point
	 * 
	 * @param args
	 * 			ignored
	 */
	public static void main(String[] args) {
		
		JFlightLogSwingLauncher launcher = new JFlightLogSwingLauncher();
		
		launcher.launch();
		
	}
	
	
	
}


